-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add optional --python arg when --uv is used to create venv #3560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I was blocked by not being able to specify the python path to ╰─$ git diff
diff --git a/isaaclab.sh b/isaaclab.sh
index 263ff88e8a..92f66eb9d3 100755
--- a/isaaclab.sh
+++ b/isaaclab.sh
@@ -496,7 +496,8 @@ print_help () {
echo -e "\t-d, --docs Build the documentation from source using sphinx."
echo -e "\t-n, --new Create a new external project or internal task from template."
echo -e "\t-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'."
- echo -e "\t-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
+ echo -e "\t-u, --uv [NAME] [PYTHON_PATH] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
+ echo -e "\t Optional PYTHON_PATH: Python interpreter path (e.g., '3.11', 'python3.10', or '/usr/bin/python3.11')."
echo -e "\n" >&2
}
@@ -599,8 +600,25 @@ while [[ $# -gt 0 ]]; do
uv_env_name=$2
shift # past argument
fi
+
+ # check if python path is provided
+ if [ -n "$2" ] && [[ "$2" != -* ]]; then
+ echo "[INFO] Using python interpreter: $2"
+ python_path="$2"
+ shift # past argument
+ else
+ # use default python version based on Isaac Sim version
+ if is_isaacsim_version_4_5; then
+ echo "[INFO] Detected Isaac Sim 4.5 → using python 3.10"
+ python_path="3.10"
+ else
+ echo "[INFO] Using default python 3.11"
+ python_path="3.11"
+ fi
+ fi
+
# setup the uv environment for Isaac Lab
- setup_uv_env ${uv_env_name}
+ setup_uv_env ${uv_env_name} ${python_path}
shift # past argument
;;
-f|--format) |
I agree with @rowoflo that the default should be the version based on isaacsim (that's what I had intended the default behavior to be). Thanks for this PR! I'm not sure if you need so much context in the help script, but the core change + default fixes the problem. |
@kellyguo11 with a little polish this should solve #3524 |
@KyleM73 |
echo -e "\t Optionally specify a Python interpreter path to use for the environment." | ||
echo -e "\nExamples:" | ||
echo -e "\t 1. uv environment creation:" | ||
echo -e "\t\t1.a create env_isaaclab with system python3" | ||
echo -e "\t\t$(basename "$0") --uv" | ||
echo -e "\t\t1.b create myenv with system python3" | ||
echo -e "\t\t$(basename "$0") --uv myenv " | ||
echo -e "\t\t1.c create myenv with specified Python 3.11" | ||
echo -e "\t\t$(basename "$0") --uv myenv --python ${HOME}/isaacsim50/kit/python/bin/python3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should go to the docs instead of having it here? Or maybe more optional, i.e. printed only when uv --help
is passed? Otherwise it becomes many things.
echo "[INFO] Using uv environment name: $2" | ||
uv_env_name=$2 | ||
shift # past argument | ||
uv_env_name="env_isaaclab" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to just pass through all arguments from the user following --uv
?
This will then include name, python path or other uv-related params that a user may want to pass through?
Description
This PR directly addresses #3559.
Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there